<!--- <cfparam name="workshopID" type="integer" />
<cfparam name="returnView" type="string" default="launch" />
<cfparam name="printable" type="boolean" default="true" />

<cfscript>
	base = new assets.calgrants.com.Base();
	orderGateway = new assets.calgrants.com.gateway.OrderGateway();
	order = orderGateway.get(Order_ID = orderID);
	storedProcedureGateway = new assets.calgrants.com.gateway.StoredProcedureGateway();
	qNextWorkshopDate = storedProcedureGateway.call(sp = "getNextWorkshopDate", Organization_ID = order.getOrganization_ID());
	nextWorkshopDate = qNextWorkshopDate.Next_Workshop_Date;
</cfscript>

<cfif order.getOrder_ID() gt 0>

	<cfscript>
		organizationGateway = new assets.calgrants.com.gateway.OrganizationGateway();
		organization = organizationGateway.get(Organization_ID = order.getOrganization_ID());
		userGateway = new assets.calgrants.com.gateway.UserGateway();
		orderedBy = userGateway.get(User_ID = order.getOrdered_By_ID());
		orderValueGateway = new assets.calgrants.com.gateway.OrderValueGateway();
		orderValues = orderValueGateway.query();
	</cfscript>
	
	<cfif NOT printable>

		<script type="text/javascript" language="javascript">
		<!--
			<!--- <cfoutput>
				var orderValues = #SerializeJSON(orderValues, false)#;
			</cfoutput> --->
			
			$(function() {
				$("#orderModal").modal();
				resizeModal("orderModal");
				validate = function() {
					var errorMessages = [];
					return true;				
				}
			})
		//-->
		</script>
		
		<cfoutput>
	
			<div id="orderModal" class="modal modal-fullscreen" data-backdrop="static">
				<div class="modal-header">
					<h3>Order</h3>
				</div>
				<div class="modal-body">
					<div class="container-fluid">
						<div class="row-fluid">
							<div class="span4">
								<div class="text-control">
									<label>Status</label>
									<cfif order.getApproved() eq 1>
										Approved
									<cfelse>
										Pending Approval
									</cfif>
								</div>
								<div class="text-control">
									<label>Order Date</label>
									#DateFormat(order.getDate_Created(), "m/d/yyyy")#
								</div>
								<div class="text-control">
									<label>Next Workshop Date</label>
									#DateFormat(nextWorkshopDate, 'm/d/yyy')#
								</div>
								<div class="text-control">
									<label>Anticipated Ship Date</label>
									#DateFormat(order.getAnticipated_Ship_Date(), "m/d/yyyy")#
								</div>
								<div class="clearfix">
									<label>Anticipated number of students</label>
									#order.getStudent_Count()#
								</div>
								<div class="clearfix">
									<label>Anticipated number of volunteers</label>
									#order.getVolunteer_Count()#
								</div>
							</div>
							<div class="span4">
								<div class="text-control">
									<label>Shipping Address</label>
									#order.getShipping_Organization()#<br />
									#order.getShipping_Department()#<br />
									#order.getShipping_Name()#<br />
									#order.getShipping_Address()#<br />
									#order.getShipping_City()#, CA #order.getShipping_Zip_Code()#
								</div>
								<div class="text-control">
									<label>Shipping Instructions</label>
									<cfif Len(Trim(order.getShipping_Instructions())) gt 0>
										#order.getShipping_Instructions()#
									<cfelse>
										None
									</cfif>
								</div>
								<!--- <div class="text-control">
									<label>Ship To Organization</label>
									#order.getShipping_Organization()#
								</div>
								<div class="text-control">
									<label>Ship To Department</label>
									#order.getShipping_Department()#
								</div>
								<div class="text-control">
									<label>Ship To Recipient Name</label>
									#order.getShipping_Name()#
								</div>
								<div class="text-control">
									<label>Ship To Address</label>
									#order.getShipping_Address()#
								</div>
								<div class="text-control">
									<label>Ship To City</label>
									#order.getShipping_City()#
								</div>
								<div class="text-control">
									<label>Ship To Zip Code</label>
									#order.getShipping_Zip_Code()#
								</div>
								<div class="text-control">
									<label>Recipient Phone</label>
									#order.getShipping_Phone()#
								</div>
								<div class="text-control">
									<label>Shipping Instructions</label>
									<cfif Len(Trim(order.getShipping_Instructions())) gt 0>#order.getShipping_Instructions()#<cfelse>None</cfif>
								</div> --->
							</div>
							<div class="span4">
								<div class="text-control">
									<label>Organization</label>
									#organization.getOrganization()#<br />
									#organization.getAddress()#<br />
									#organization.getCity()#, CA #organization.getZip_Code()#
								</div>
								<div class="text-control">
									<label>Ordered By</label>
									#orderedBy.getFirst_Name()# #orderedBy.getLast_Name()#<br />
									<a href="mailto:#orderedBy.getEmail()#">#orderedBy.getEmail()#</a><br />
									#orderedBy.getPhone()#<cfif Len(Trim(orderedBy.getExtension())) gt 0> x #orderedBy.getExtension()#</cfif>
								</div>
								<div class="text-control">
									<label>Order ID</label>
									#order.getOrder_ID()#
								</div>
								<div class="text-control">
									<label>Date Created</label>
									#DateFormat(order.getDate_Created(), "mmmm d yyyy")# @ #TimeFormat(order.getDate_Created(), "h:mmtt")#
								</div>
							</div>
						</div>
						<div class="row-fluid">
							<div class="span12">							
								<table class="table table-striped table-bordered" style="margin-top: 30px;">
									<thead>
										<tr>
											<th nowrap="nowrap">Item No.</th>
											<th>Category</th>
											<th>Item</th>
											<th>Quantity</th>
										</tr>
									</thead>
									<tbody>
										<cfloop query="orderValues">
											<cfset itemQty = 0>
											<cfset itemIndex = ListFind(order.getOrder_Value_IDs(), Order_Value_ID)>
											<cfif itemIndex gt 0>
												<cfset itemQty = ListGetAt(order.getQuantities(), itemIndex)>
												<cfif itemQty gt 0>
													<tr>
														<td>#SKU#</td>
														<td>#Category#</td>
														<td>#Description#</td>
														<td>#itemQty#</td>
													</tr>
												</cfif>
											</cfif>
										</cfloop>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<a class="btn" href="?view=#returnView#">Close</a>
				</div>
			</div>
		
		</cfoutput>
		
	<cfelseif printable>
	
		<cfoutput>
		
			<h2>California Cash for College Workshop Wrapper Setup Instructions</h2>
	
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span8">
					
					</div>
					<div class="span4">
						<img src="#request.pathToApplication#/common/images/screenshots/wrapper1.png" class="image-polariod" width="600" height="338" />
					</div>
				</div>
				<div class="row-fluid">
					<div class="span8">
					
					</div>
					<div class="span4">
						<img src="#request.pathToApplication#/common/images/screenshots/wrapper1.png" class="image-polariod" width="600" height="338" />
					</div>
				</div>
				<div class="row-fluid">
					<div class="span8">
					
					</div>
					<div class="span4">
						<img src="#request.pathToApplication#/common/images/screenshots/wrapper1.png" class="image-polariod" width="600" height="338" />
					</div>
				</div>
				<div class="row-fluid">
					<div class="span8">
					
					</div>
					<div class="span4">
						<img src="#request.pathToApplication#/common/images/screenshots/wrapper1.png" class="image-polariod" width="600" height="338" />
					</div>
				</div>
			</div>
		
		</cfoutput>

	</cfif>

<cfelse>

	<div class="alert alert-info notFound">Order not found or insufficient permissions to perform this operation</div>

</cfif>
<!--- <cfparam name="orderID" type="integer" default="0" />
<cfparam name="returnView" type="string" default="workshops" />
<cfparam name="printable" type="boolean" default="false">

<cfinvoke component="#request.pathToGateways#.OrderGateway" method="get" returnvariable="order">
	<cfinvokeargument name="Order_ID" value="#orderID#" />
</cfinvoke>

<cfscript>
	base = new assets.calgrants.com.Base();
	orderGateway = new assets.calgrants.com.gateway.OrderGateway();
	order = orderGateway.get(Order_ID = orderID);
</cfscript>

<cfoutput>

	<cfif NOT printable>
		<p>
			<a href="#script_name#?view=orders" class="btn">Back</a>
		</p>
	</cfif>

	<cfif order.getOrder_ID() gt 0>
	
		<cfinvoke component="#request.pathToGateways#.OrganizationGateway" method="get" returnvariable="organization">
			<cfinvokeargument name="Organization_ID" value="#order.getOrganization_ID()#" />
		</cfinvoke>
		<cfinvoke component="#request.pathToGateways#.UserGateway" method="get" returnvariable="orderedBy">
			<cfinvokeargument name="User_ID" value="#order.getOrdered_By_ID()#" />
		</cfinvoke>
		<cfinvoke component="#request.pathToGateways#.OrderValueGateway" method="query" returnvariable="orderValues" />
        
		<table border="0" width="100%">
			<tr valign="top">
				<td width="50%">
				
					<h3>Order Information</h3>
					
					<table border="1" cellpadding="6" cellspacing="0" width="80%">
						<tbody>
							<tr>
								<td><strong>Order ID</strong></td>
								<td>#order.getOrder_ID()#</td>
							</tr>
							<tr>
								<td><strong>Status</strong></td>
								<td>
									<cfif order.getApproved()>
										Approved
									<cfelse>
										<font color="red">Not approved</font>
									</cfif>
								</td>
							</tr>
							<tr>
								<td><strong>Organization</strong></td>
								<td>#organization.getOrganization()#</td>
							</tr>
							<tr>
								<td><strong>Ordered By</strong></td>
								<td>
									<cfif NOT orderedBy.getApproved()>
										<font color="red">#orderedBy.getFirst_Name()# #orderedBy.getLast_Name()#</font>
									<cfelse>
										#orderedBy.getFirst_Name()# #orderedBy.getLast_Name()#
									</cfif>
								</td>
							</tr>
							<tr>
								<td><strong>Order Date</strong></td>
								<td>#DateFormat(order.getDate_Created(), "m/d/yyyy")#</td>
							</tr>
							<tr>
								<td><strong>Anticipated Ship Date</strong></td>
								<td>#DateFormat(order.getAnticipated_Ship_Date(), "m/d/yyyy")#</td>
							</tr>
							<tr>
								<td><strong>Fulfillment Date</strong></td>
								<td>#DateFormat(order.getFulfillment_Date(), "m/d/yyyy")#</td>
							</tr>
							<tr>
								<td><strong>Anticipated Students</strong></td>
								<td>#order.getStudent_Count()#</td>
							</tr>
							<tr>
								<td nowrap="nowrap"><strong>Anticipcated Volunteers</strong></td>
								<td width="100%">#order.getVolunteer_Count()#</td>
							</tr>
						</tbody>
					</table>
					
				</td>
				<td width="50%">
				
					<h3>Shipping Information</h3>
	
					<table border="1" cellpadding="6" cellspacing="0" width="80%">
						<tbody>
							<tr>
								<td><strong>Organization</strong></td>
								<td>#order.getShipping_Organization()#</td>
							</tr>
			
							<tr>
								<td><strong>Department</strong></td>
								<td>#order.getShipping_Department()#</td>
							</tr>
							<tr>
								<td nowrap="nowrap"><strong>Recipient Name</strong></td>
								<td width="100%">#order.getShipping_Name()#</td>
							</tr>
							<tr>
								<td><strong>Address</strong></td>
								<td>#order.getShipping_Address()#</td>
							</tr>
							<tr>
								<td><strong>City</strong></td>
								<td>#order.getShipping_City()#</td>
							</tr>
							<tr>
								<td><strong>Zip Code</strong></td>
								<td>#order.getShipping_Zip_Code()#</td>
							</tr>
							<tr>
								<td><strong>Phone</strong></td>
								<td>#order.getShipping_Phone()#</td>
							</tr>
							<tr>
								<td><strong>Instructions</strong></td>
								<td>#order.getShipping_Instructions()#</td>
							</tr>
						</tbody>
					</table>
				</td>
			</tr>
		</table>

		
		<h3>Order Details</h3>
	
		<table border="1" cellpadding="6" cellspacing="0" width="100%">
			<thead>
				<tr>
					<td><strong>Item No.</strong></td>
					<td><strong>Category</strong></td>
					<td><strong>Item</strong></td>
					<td><strong>Quantity</strong></td>
				</tr>
			</thead>
			<tbody>
				<cfloop query="orderValues">
					<cfset itemQty = 0>
					<cfset itemIndex = ListFind(order.getOrder_Value_IDs(), Order_Value_ID)>
					<cfif itemIndex gt 0>
						<cfset itemQty = ListGetAt(order.getQuantities(), itemIndex)>
					</cfif>
					<cfif itemQty gt 0>
						<tr>
							<td>#SKU#</td>
							<td>#Category#</td>
							<td>#Description#</td>
							<td>#itemQty#</td>
						</tr>
					</cfif>
				</cfloop>	
			</tbody>				
		</table>

	<cfelse>

		<div class="alert alert-info notFound">Order not found or insufficient permissions to perform this operation</div>

	</cfif>

</cfoutput> ---> --->